//
//  LGServiceDetailController.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/3/29.
//  服务包详情

#import "LGServiceDetailController.h"

@interface LGServiceDetailController ()
/**   */
@property (nonatomic , strong)UIScrollView *scrollView;
/**   */
@property (nonatomic , strong)UIImageView *imageView;

@end

@implementation LGServiceDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"慢病服务";
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.scrollView];
    [self.scrollView addSubview:self.imageView];
    [self requestData];
}

-(void)requestData{
    [RequestUtil withPOST:@"/doctor/vip/vipurl" parameters:@{@"vip_id":self.vipId} withSign:YES success:^(NSInteger code, NSString *message, id returnData) {
        if(code == 200){
            [self.imageView sd_setImageWithURL:[NSURL URLWithString:returnData[@"url"]]];
            CGFloat width = [returnData[@"width"] floatValue];
            CGFloat height = [returnData[@"height"] floatValue];
            CGFloat totalHeight = Screen_W*height/width;
            self.imageView.frame = CGRectMake(0, 0, Screen_W, totalHeight);
            self.scrollView.contentSize = CGSizeMake(Screen_W, totalHeight);
        }
    } error:^(NSError *error) {
        
    }];
}


-(UIScrollView *)scrollView{
    if(!_scrollView){
        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, Screen_W, Screen_H-topBarHeight)];
        _scrollView.backgroundColor = [UIColor whiteColor];
        _scrollView.bounces = NO;
    }
    return _scrollView;
}

-(UIImageView *)imageView{
    if(!_imageView){
        _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, Screen_W, Screen_H-topBarHeight)];
    }
    return _imageView;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
